package com.cloud.force.api.handler.common;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;

import com.cloud.force.api.handler.Request;
import com.cloud.force.api.handler.Response;
import com.cloud.force.api.handler.SurroundHandler;

public class OverTimeLogHandler extends SurroundHandler{
	private static final Logger logger = LoggerFactory.getLogger(OverTimeLogHandler.class);
	
	private long timemillions = 0;
	@Override
	public void afterHandler(Request request, Response resp, ApplicationContext context) {
		long executedSec = (System.currentTimeMillis() - timemillions)/1000;
		if(executedSec > 1){
			logger.debug("指令执行超时日志:"+ request);
		}
	}

	@Override
	public void beforeHandler(Request request, Response resp, ApplicationContext context) {
		timemillions = System.currentTimeMillis();
	}

}
